package practice;

public class test {

    private static Object locker1 = new Object();
    private static Object locker2 = new Object();
    public static void main1(String[] args) {
        Thread t1 = new Thread(() -> {
            try {
                synchronized (locker1) {
                    Thread.sleep(1000);
                    synchronized (locker2) {
                        System.out.println("t1");
                    }
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        });
        Thread t2 = new Thread(() -> {
            try {
                synchronized (locker2) {
                    Thread.sleep(1000);
                    synchronized (locker1) {
                        System.out.println("t1");
                    }
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        });
        t1.start();
        t1.setName("线程1");
        t2.setName("线程2");
        t2.start();
    }

    public static void main2(String[] args) {
        Day12 day12 = new Day12();
//        System.out.println(day12.getLongestPalindrome("ccbcabaabba"));
        int[] image1 = {0,0,0};
        int[] image2 = {0,0,0};
        int[][] image = new int[2][2];
        image[0] = image1;
        image[1] = image2;
        day12.floodFill(image,1,0,2);
    }

    public static void main(String[] args) {
        Day18 day18 = new Day18();
        day18.calculate("42");
    }
}
